#pragma once
#include <cmath>
#include "material.h"



class wingbox;

class box :public object {
public:
	box(double w, double h, double t, double l,  double sweep_degrees, const material& mat, double rootclampsize = 110, double tipclampsize = 65) 
		: object(w, t, l, mat),
		height(h / 1000),
		sweep(M_PI * sweep_degrees / 180.0),
		rootclamp(rootclampsize / 1000.0),
		tipclamp(tipclampsize / 1000.0),
		kc(3.6)
	{
	}

	double inertia() const
	{
		return ( width * std::pow(height, 3)  - 
			(width - 2 * thickness) * std::pow(height - 2 * thickness, 3))/12.0;
	}	

	double centroid() const
	{
		 return height / 2;
	}


	double weight () const
	{
		return (area() * length - width * std::tan(sweep) * thickness * (height + width) ) * m.density;
	}

	double area() const
	{
		return width*height - (width - 2 * thickness) * (height - 2 * thickness);
	}
	double& getHeight()
	{
		return height;
	}
	const double& getHeight() const
	{
		return height;
	}
	void setHeight(double h)
	{
		height = h / 1000;
	}
	double& getSweep()
	{
		return sweep;
	}
	const double& getSweep() const
	{
		return sweep;
	}
	void setSweep(double a) 
	{
		sweep = M_PI * a / 180.0;
	}
	double& getRootClamp()
	{
		return rootclamp;
	}
	const double& getRootClamp() const
	{
		return rootclamp;
	}
	void setRootClamp(double d) 
	{
		rootclamp = d / 1000;
	}
	double& getTipClamp()
	{
		return tipclamp;
	}
	const double& getTipClamp() const
	{
		return tipclamp;
	}
	void setTipClamp(double d)
	{
		tipclamp = d / 1000;
	}
	double& getKc()
	{
		return kc;
	}
	const double& getKc() const
	{
		return kc;
	}
	void setKc(double k)
	{
		kc = k;
	}

private:
	double height;
	double sweep;
	double rootclamp;
	double tipclamp;
	double kc;


};